package net.lab1024.sa.admin.module.business.category.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lab1024.sa.admin.module.business.category.domain.entity.RoleUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface RoleUserMapper extends BaseMapper<RoleUser> {

    @Insert("<script>" +
            "INSERT INTO t_role_user (role_id, user_id, create_time, update_time) " +
            "VALUES (#{entity.roleId}, #{entity.userId}, #{entity.createTime}, #{entity.updateTime}) " +
            "ON DUPLICATE KEY UPDATE update_time = CURRENT_TIMESTAMP" +
            "</script>")
    int insertOrIgnore(@Param("entity") RoleUser entity);
}